<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateStoreVisitsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('store_visits', function (Blueprint $table) {
            $table->id()->comment('商品浏览分析表');
            $table->integer('user_id')->index()->comment('用户id');
            $table->integer('product_id')->index()->comment('商品id');
            $table->integer('category_id')->index()->comment('商品分类id');
            $table->string('product_type',32)->comment('商品类型');
            $table->char('type',50)->comment('访问类型');
            $table->integer('count')->comment('访问次数');
            $table->string('remark',255)->nullable()->comment('备注描述');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('store_visits');
    }
}
